package com.design_patterns.command;

/**
 * @author: 李德才
 * @description:
 * @create: 2020-09-19 17:15
 **/
public class InsertCommand extends Command {
    Content content;
    private String string;

    public InsertCommand(Content content, String string) {
        this.content = content;
        this.string = string;
    }

    @Override
    public void doIt() {
        content.stringList.add(string);
    }

    @Override
    public void undo() {
        content.stringList.remove(content.stringList.size() - 1);
    }
}
